package com.utility;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;

import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

public class ApplicationContextUtil {
	
	public static Object getSpecifiedBean(String beanName,HttpServletRequest servletRequest){
		WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(servletRequest.getServletContext());		
		return ctx.getBean(beanName);
     }
	
}
